namespace RoccaStore.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class InitialCreate : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.FileSend",
                c => new
                    {
                        FileSendID = c.Int(nullable: false, identity: true),
                        FileID = c.Int(nullable: false),
                        AccountID = c.Int(),
                        From = c.String(maxLength: 4000),
                        IP = c.String(maxLength: 4000),
                        Message = c.String(maxLength: 4000),
                        Available = c.Int(nullable: false),
                        SendDate = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.FileSendID);
            
            CreateTable(
                "dbo.FileInfo",
                c => new
                    {
                        FileInfoID = c.Int(nullable: false, identity: true),
                        FileSendID = c.Int(),
                        Filename = c.String(maxLength: 4000),
                        Slug = c.String(maxLength: 4000),
                        Type = c.Int(nullable: false),
                        Extension = c.String(maxLength: 4000),
                        IP = c.String(maxLength: 4000),
                        CreatedDate = c.DateTime(nullable: false),
                        Size = c.Int(nullable: false),
                        FormattedSize = c.String(maxLength: 4000),
                    })
                .PrimaryKey(t => t.FileInfoID)
                .ForeignKey("dbo.FileSend", t => t.FileSendID)
                .Index(t => t.FileSendID);
            
            CreateTable(
                "dbo.Recipients",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        FileSendID = c.Int(nullable: false),
                        Email = c.String(maxLength: 4000),
                        FileSend_ID = c.Int(),
                    })
                .PrimaryKey(t => t.ID)
                .ForeignKey("dbo.FileSend", t => t.FileSendID, cascadeDelete: true)
                .ForeignKey("dbo.FileSend", t => t.FileSend_ID)
                .Index(t => t.FileSendID)
                .Index(t => t.FileSend_ID);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.Recipients", new[] { "FileSend_ID" });
            DropIndex("dbo.Recipients", new[] { "FileSendID" });
            DropIndex("dbo.FileInfo", new[] { "FileSendID" });
            DropForeignKey("dbo.Recipients", "FileSend_ID", "dbo.FileSend");
            DropForeignKey("dbo.Recipients", "FileSendID", "dbo.FileSend");
            DropForeignKey("dbo.FileInfo", "FileSendID", "dbo.FileSend");
            DropTable("dbo.Recipients");
            DropTable("dbo.FileInfo");
            DropTable("dbo.FileSend");
        }
    }
}
